const LOCAL_NAME = 'userStorage'
const LOCAL_TOKEN_NAME = 'token'
const LOCAL_ACCOUNT_NAME = 'accountNumber'

import { ls } from '@/utils/store'

export function defaultSetting() {
    return {
        userInfo: getLocalStore(),
        token: getToken(),
        accountNumber: getAccountNumber()
    }
}

export function getLocalStore() {
    return ls.get(LOCAL_NAME) || null
}

export function setLocaStore(data) {
    ls.set(LOCAL_NAME, data)
}

export function getToken() {
    return ls.get(LOCAL_TOKEN_NAME) || null
}

export function setToken(data) {
    ls.set(LOCAL_TOKEN_NAME, data)
}

export function reset(){
    ls.set(LOCAL_TOKEN_NAME, null)
    ls.set(LOCAL_NAME, null)
}

export function getAccountNumber(){
    return ls.get(LOCAL_ACCOUNT_NAME) || null
}

export function setAccountNumber(data){
    return ls.set(LOCAL_ACCOUNT_NAME, data)
}
